package unit4_1015.test3;
/*
 * 抽象类的作用就是被继承,自身不产生对象.
 * 使用多态重构电子宠物系统。实现为宠物看病，喂宠物食物。
 */
public abstract class Pet {
	
	private String name;
	private int health;
	private String sex;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getHealth() {
		return health;
	}
	public void setHealth(int health) {
		if(health<1 || health>100) {
			health=60;
		}
		this.health = health;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public Pet(String name, int health, String sex) {
		super();
		this.name = name;
		this.health = health;
		this.sex = sex;
	}
	public Pet() {
		super();
	}
	
	//去医院看病
	public abstract void toHospital();
	
	//吃东西
	public abstract void eat();
	
}
